package com.yeyoo.websocket.websocket;

import com.yeyoo.websocket.handler.TestWebSocketHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.socket.TextMessage;

/**
 * Created by SunJianKang@163.com on 2020-11-04.
 */
@Configuration
@EnableScheduling
public class TaskSocket {

    @Scheduled(cron = "0/5 * * * * ?")
    public void task () {
       /* WebServicePoint webServicePoint = new WebServicePoint();
        webServicePoint.sendMessagess("nihao");*/


        TestWebSocketHandler testWebSocketHandler = new TestWebSocketHandler();
        TextMessage textMessage = new TextMessage("nihao WebSocket!");
        testWebSocketHandler.sendMessageToUser("sjk", textMessage);
    }
}
